<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
		<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
		<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
		<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

<script type="text/javascript" src="<%=basePath%>Js/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/mycss/bootstrap.min.css" />
</head>

<script type="text/javascript">

//添加超市商品
function addsupermaket(){
	
	var product = $("#product").val();
	var classify = $("#classify").val();
	var quantity = $("#quantity").val();
	var remarks = $("#remarks").val();
	var price = $("#price").val();
	
	$.ajax({
		type:"post",
		url:"<%=basePath%>addsupermaket.do",
			data : {
				"product" : product,
				"classify" : classify,
				"quantity" : quantity,
				"remarks" : remarks,
				"price":price,
			},
			dataType : "text",
			success : function(result) {
				if (result == "1") {
					alert("添加成功")
				} else {
					alert("添加失败")
				}
			},
			error : function() {
				alert("系统故障")
			}

		})
	}
</script>

<body>
<div align="center"><hr><h3>添加超市商品</h3><hr></div>


	<div
		style="position: absolute; left: 400px; top: 120px; width: 400px; height: 100px">
		<form action="" id="myFrom">
			<table class="table table-bordered">
				<tr>
					<td>商品名称</td>
					<td><input type="text" class="form-control" id="product"
						placeholder="请输入商品名称"></td>
				</tr>
				<tr>
					<td>商品分类</td>
					<td><input type="text" class="form-control" id="classify"
						placeholder="请输入商品分类"></td>
				</tr>
					<tr>
					<td>单价</td>
					<td><input type="text" class="form-control" id="price"
						placeholder="请输入商品单价"></td>
				</tr>
				<tr>
					<td>数量</td>
					<td><input type="text" class="form-control" id="quantity"
						placeholder="请输入商品数量"></td>
				</tr>
				<tr>
					<td>备注</td>
					<td><textarea rows="5" cols="50" name="remarks" id="remarks"
							class="form-control"></textarea></td>
				</tr>

			</table>

			<div align="right">
				<button type="reset" form="myFrom" class="btn btn-danger">重置</button>
				<button type="button" class="btn btn-success"
					onclick="addsupermaket()">添加</button>
			</div>
		</form>

	</div>

</body>
</html>